package ca.jerg.wizard;

import javax.swing.*;
import java.awt.BorderLayout;
import ca.jerg.layout.SpringUtilities;

public class ErgWizardWarmUpPanel extends JPanel
{
	private static final long serialVersionUID = 1L;
	private JTextPane textPane;
	private JTextField warmUpTime;
	private JTextField description;
	
	public ErgWizardWarmUpPanel() 
    {   	                
		setLayout(new BorderLayout());
		add(getContentPanel());
    }
	
	public String getWarmUpTime()
	{
		return warmUpTime.getText();
	}
	
	public String getDescription()
	{
		return description.getText();
	}
	
	public JTextPane getTextPane()
	{
		return textPane;
	}
	
	private JPanel getContentPanel()
	{
		JPanel detailsPanel = new JPanel();
		detailsPanel.setLayout(new BorderLayout());
		
		warmUpTime = new JTextField("15");
		warmUpTime.setToolTipText("Enter warm up time, in minutes.");
		JLabel label = new JLabel("Warm up time");
		label.setLabelFor(warmUpTime);
				
		textPane = new JTextPane();	
		textPane.setEditable(false);
		JScrollPane scroll = new JScrollPane(textPane);

		description = new JTextField(" ");
		description.setToolTipText("Enter a short description for the workout.");
		JLabel label2 = new JLabel("Description");
		label2.setLabelFor(description);
		
		JPanel panel1 = new JPanel();
		panel1.setLayout(new SpringLayout());
		panel1.add(label);
		panel1.add(warmUpTime);
		SpringUtilities.makeCompactGrid(panel1,1,2,6,6,6,6);

		JPanel panel2 = new JPanel();
		panel2.setLayout(new SpringLayout());
		panel2.add(new JLabel("Workout Details"));
		panel2.add(scroll);
		SpringUtilities.makeCompactGrid(panel2,2,1,6,6,6,6);
		
		JPanel panel3 = new JPanel();
		panel3.setLayout(new SpringLayout());
		panel3.add(label2);
		panel3.add(description);
		SpringUtilities.makeCompactGrid(panel3,1,2,6,6,6,6);
		
		detailsPanel.add(panel1,BorderLayout.NORTH);
		detailsPanel.add(panel2,BorderLayout.CENTER);
		detailsPanel.add(panel3,BorderLayout.SOUTH);
		
		JPanel contentPanel = new JPanel();
		contentPanel.setLayout(new BorderLayout());
		contentPanel.add(detailsPanel,BorderLayout.CENTER);
		
		return contentPanel;
	}
	
}
